package com.haoshuang.zhouzhoubang.ui.adapter

import android.graphics.Color
import com.haoshuang.zhouzhoubang.R
import com.haoshuang.zhouzhoubang.databinding.ItemFocusDateDayBinding
import com.haoshuang.zhouzhoubang.model.bean.FocusDateBean
import com.mufeng.libs.base.BaseBindingHolder
import com.mufeng.libs.base.BaseBindingQuickAdapter
import com.mufeng.libs.utils.view.gone
import com.mufeng.libs.utils.view.visible

/**
 *
 */
class FocusDateDayAdapter(data: MutableList<FocusDateBean>) :
    BaseBindingQuickAdapter<FocusDateBean, ItemFocusDateDayBinding>(data) {

    override fun onBindViewHolder(holder: BaseBindingHolder, position: Int, item: FocusDateBean?) {
        if (item == null) return
        holder.getViewBinding<ItemFocusDateDayBinding>().apply {
            if (item.isCheck == 0) {
                tvName.setBackgroundColor(Color.parseColor("#ffffff"))
                tvName.setTextColor(Color.parseColor("#333333"))
            } else {
                tvName.setBackgroundResource(R.drawable.bg_main)
                tvName.setTextColor(Color.parseColor("#ffffff"))
            }
            tvName.text = item.day
            if (item.list?.is_person_order != 1) {
                ivTao2.gone()
            } else {
                ivTao2.visible()
            }

            if (item.list?.is_team_order != 1) {
                ivTao1.gone()
            } else {
                ivTao1.visible()
            }
            if (item.list?.is_taocan_order != 1) {
                ivTao.gone()
            } else {
                ivTao.visible()
            }
        }
    }
}
